package cn.jhs.platform.controller;

import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author Trump
 * @desc
 * @date 2019/3/29 9:39
 */
@Controller
public class LoginController {

	@RequestMapping("/login")
	public String login(){
		Authentication auth = SecurityContextHolder.getContext().getAuthentication();
		if(auth instanceof AnonymousAuthenticationToken){
			return "/login";
		}else{
			return "/success";
		}
	}
}
